home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / machack / Hacks96 / FlyPaper.sit / Fly Paper / FlyPaper Source / App Sources / ST_ / ST_.h next >
Text File  |  1996-06-22  |  1KB  |  30 lines

  1. #ifndef DECLARE_ST_
  2.  
  3. #define    DECLARE_ST_(CLASSNAME, TYPE, DTOR, SAFEVAL)                                                 \
  4.                                                                                                     \
  5.     class CLASSNAME {                                                                                \
  6.         private:                                                                                    \
  7.             TYPE    the##TYPE;                                                                        \
  8.             void operator = (const TYPE &a##TYPE);                                                    \
  9.         public:                                                                                        \
  10.             CLASSNAME (const TYPE &a##TYPE) {the##TYPE = a##TYPE;}                                    \
  11.             ~CLASSNAME () {if (the##TYPE != SAFEVAL) DTOR (the##TYPE);}                                \
  12.             operator TYPE& (void) {return the##TYPE;}                                                \
  13.             void Forget (void) {the##TYPE = SAFEVAL;}                                                \
  14.     };
  15.  
  16. #define    DECLARE_STP_(CLASSNAME, TYPE, DTOR, SAFEVAL)                                                 \
  17.                                                                                                     \
  18.     class CLASSNAME {                                                                                \
  19.         private:                                                                                    \
  20.             TYPE    the##TYPE;                                                                        \
  21.             void operator = (const TYPE &a##TYPE);                                                    \
  22.         public:                                                                                        \
  23.             CLASSNAME (const TYPE &a##TYPE) {the##TYPE = a##TYPE;}                                    \
  24.             ~CLASSNAME () {if (the##TYPE != SAFEVAL) DTOR (&the##TYPE);}                                \
  25.             operator TYPE& (void) {return the##TYPE;}                                                \
  26.             void Forget (void) {the##TYPE = SAFEVAL;}                                                \
  27.     };
  28.  
  29. #endif
  30.